package com.bulemobi.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
/***
 * 
 * @author zengys  输入框验证码帮助工具
 * 
 * 2014年9月21日 13:25:36
 * 
 * 
 * */
public class VerifyUtil {
	/**
	 * 验证邮箱号
	 * 
	 * @param mobiles
	 * @return
	 */
	public static boolean is_Email(String email_str) {
		String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
		Pattern p = Pattern.compile(str);
		Matcher m = p.matcher(email_str);
		return m.matches();
	}

	/**
	 * 验证手机号
	 * 
	 * @param mobiles
	 * @return
	 */
	public static boolean isMobileNO(String mobiles) {
		Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,3-9]))\\d{8}$");
		Matcher m = p.matcher(mobiles);
		return m.matches();
	}
	/**
	 * 验证数字
	 * 
	 * @param number
	 * @return
	 */
	public static boolean isNumber(String number){
		Pattern p = Pattern.compile("[0-9]*");
		Matcher m = p.matcher(number);
		return m.matches();
	}
	/**
	 * 验证大小写字母
	 * 
	 * @param mobiles
	 * @return
	 */
	public static boolean isLetter(String letter){
		Pattern p = Pattern.compile("[a-zA-Z]");
		Matcher m = p.matcher(letter);
		return m.matches();
	}
	/**
	 * 验证大小写字母数字
	 * 
	 * @param letter and number
	 * @return
	 */
	public static boolean isLetterOrNumber(String letterornumber){
		Pattern p = Pattern.compile("^[A-Za-z0-9]+$");
		Matcher m = p.matcher(letterornumber);
		return m.matches();
	}
	

}
